import sys

from PySide6 import QtWidgets, QtCore
from PySide6.QtWidgets import QLabel


class MainWindow(QtWidgets.QWidget):
    def __init__(self):
        super().__init__()

        self.setWindowTitle('PySide6 Slider')
        self.resize(400, 300)

        slider = QtWidgets.QSlider(QtCore.Qt.Orientation.Horizontal)
        # slider.setRange(0, 100)
        slider.setMinimum(0)
        slider.setMaximum(100)
        slider.setTickInterval(10)
        slider.setTickPosition(QtWidgets.QSlider.TickPosition.TicksBelow)

        value_changed_label = QLabel("Value:", self)
        move_label = QLabel("Move:", self)

        main_layout = QtWidgets.QVBoxLayout()
        main_layout.setContentsMargins(20, 20, 20, 20)
        main_layout.addWidget(value_changed_label)
        main_layout.addWidget(move_label)
        main_layout.addWidget(slider)

        slider.valueChanged.connect(self.show_slider)
        # slider.sliderMoved.connect(self.show_slider)
        self.setLayout(main_layout)

    @QtCore.Slot()
    def show_slider(self, value):
        # print(self.event)
        # if self.event == QtWidgets.QSlider.SliderAction.SliderMove:
        #     self.move_label.setText("Move: " + str(self.sender().value()))
        # elif self.event == QtWidgets.QSlider.SliderChange.SliderValueChange:
        #     self.value_changed_label.setText("Value: " + str(value))
        print(value)
        # if self.sender().isSliderDown():
        #     print('down', value)
            # self.move_label.setText("Move: " + str(value))


if __name__ == '__main__':
    app = QtWidgets.QApplication(sys.argv)
    window = MainWindow()
    window.show()
    sys.exit(app.exec())
